Skip to content

Fix GetRawUnit for v1 MPR files: convert UUID to GUID blob#706

Open
densmoe wants to merge 1 commit into
mendixlabs:mainfrom
densmoe:fix/get-raw-unit-v1-blob
Open

Fix GetRawUnit for v1 MPR files: convert UUID to GUID blob#706
densmoe wants to merge 1 commit into
mendixlabs:mainfrom
densmoe:fix/get-raw-unit-v1-blob

Conversation

@densmoe

@densmoe densmoe commented Jun 26, 2026

Copy link
Copy Markdown

Summary

  • GetRawUnit() in sdk/mpr/reader_documents.go passes the UUID string directly to SQLite on v1 MPRs, but UnitID is stored as a 16-byte GUID blob — the query never matches
  • Added types.UUIDToBlob() conversion before the query, consistent with getUnitByIDV1() and GetRawUnitBytes() which already do this correctly

Fixes #705

Impact

Any caller combining ListPages()/ListSnippets()/etc. with GetRawUnit(id) on a v1 project (Mendix < 10.18) gets sql: no rows in result set for every unit. This makes GetRawUnit unusable on v1 MPR files.

Test plan

  • Verified on real v1 MPR files (Mendix 9.24, 10.18, 10.24) ranging from 11MB to 111MB
  • Confirmed GetRawUnit now returns valid BSON data for all page/snippet/layout units
  • Confirmed v2 projects continue working unchanged (v2 path reads from mprcontents folder, unaffected)

🤖 Generated with Claude Code

GetRawUnit passed the UUID string directly to SQLite for v1 MPRs,
but UnitID is stored as a 16-byte GUID blob. The query never matched,
silently returning "no rows" for every unit lookup on v1 projects.

Use types.UUIDToBlob() before querying, consistent with
getUnitByIDV1() in reader_units.go and GetRawUnitBytes() in
writer_security.go which already have the correct implementation.

Fixes mendixlabs#705

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

GetRawUnit fails on v1 MPR files (UUID not converted to GUID blob)

1 participant